//Direct Input Header File
//Declares the class used for Direct Input
//Jeffrey Denton	January 20, 2011

#pragma once
#include "Globals.h"

enum eClicks
{
	LEFT,
	RIGHT,
	MIDDLE
};

/*******************************************************\
*	Define class DirectInput							*
\*******************************************************/
class DirectInput
{
protected:
	IDirectInput8*			DIObject;					//Object for making Direct Input Objects
	IDirectInputDevice8*	DIKeyboard;					//Keyboard Input Device
	unsigned char			KeyState[256];				//Stores the current keyboard state
	bool					KeyPressed[256];			//Stores the previous state of the key
	IDirectInputDevice8*	DIMouse;					//Mouse Input Device
	DIMOUSESTATE2			MouseState;					//Stores the current mouse state
	POINT					CursorPosition;				//Stores the location of the cursor

	HRESULT					hr;							//Value for validations

public:
	inline static DirectInput* Into()					//Singleton Constructor
		{static DirectInput engine; return &engine;}
	virtual ~DirectInput();								//Default Destructor

	bool Init(HINSTANCE hInstance, HWND hWnd);			//Initialize Direct Input Variables
	void UpdateInput(HWND);									//Poll for input from devices
	bool Shutdown();									//Release and delete objects and devices

	bool KeyOnce(unsigned char key);					//Reads a single key press as input
	bool KeyDown(unsigned char key);					//Reads an input as long as the key is down

	bool MouseDown(int button);							//Read Mouse clicks from Mouse State

	POINT GetCursor();
};